package cn.sunxyz.spider;

import org.jsoup.nodes.Document;

/**
 * Created by yangrd on 2018/6/14
 **/
public class Page {

    private String request;

    private Document document;

    private Exception exception;

    private Page(String request, Document document) {
        this.request = request;
        this.document = document;
    }

    private Page(String request, Exception exception) {
        this.request = request;
        this.exception = exception;
    }

    public static Page of(String request, Document document) {
        return new Page(request, document);
    }

    public static Page of(String request,  Exception exception) {
        return new Page(request, exception);
    }

    public String getRequest() {
        return request;
    }

    public Document getDocument() {
        return document;
    }

    public boolean isSuccess(){
        return exception==null;
    }

}
